<template>
  <div>
    <tb-report :schemas="schemas" :columns="columns" :apiUrl="apiUrl" :tableData="tableData" :getData="getData"></tb-report>
  </div>
</template>

<script>
import TbReport from "@/components/tb-report/index.vue";

export default {
  name: "App",
  components: { TbReport },
  data() {
    return {
      title: "首页",
      apiUrl: "/scm/api/v1/scmPurchaseContractList/list",
      schemas: [
        {
          label: "追溯号",
          field: "traceBackNo",
          component: "Input",
          placeholder: "追溯号",
          required: false,
          colProps: {},
        },
        {
          label: "规格",
          field: "goodsSpecification",
          component: "Input",
          placeholder: "规格",
          required: false,
          colProps: {},
        },
      ],
      columns: [
        {
          title: "序号",
          fixed: "left",
          type: "seq",
          width: 60,
          align: "center",
        },
        {
          title: "追溯号",
          field: "traceBackNo",
          key: "traceBackNo",
          width: 200,
          align: "center",
        },
        {
          title: "状态",
          field: "goodsSubmitStatusLabel",
          key: "goodsSubmitStatusLabel",
          width: 120,
          align: "center",
        },
        {
          title: "需求清单号",
          field: "contractNo",
          key: "contractNo",
          width: 100,
        },
        {
          title: "商品名称",
          field: "goodsName",
          key: "goodsName",
          width: 120,
          align: "center",
        },
        {
          title: "单个重量(Kg)",
          field: "goodsSingleNetWeight",
          key: "goodsSingleNetWeight",
          width: 120,
          align: "center",
        },
        {
          title: "英文品名",
          field: "goodsNameEn",
          key: "goodsNameEn",
          width: 120,
          align: "center",
        },
        {
          title: "规格",
          field: "goodsSpecification",
          key: "goodsSpecification",
          width: 120,
          align: "center",
        },
        {
          title: "型号",
          field: "goodsModel",
          key: "goodsModel",
          width: 120,
          align: "center",
        },
        {
          title: "合同交货日期",
          field: "deliveryDate",
          key: "deliveryDate",
          width: 140,
        },
        {
          title: "用途",
          field: "goodsPurpose",
          key: "goodsPurpose",
          width: 120,
          align: "center",
        },
        {
          title: "数量",
          field: "purchaseQuantity",
          key: "purchaseQuantity",
          width: 120,
          align: "center",
        },
        {
          title: "成交单位",
          field: "tradeUnitLabel",
          key: "tradeUnitLabel",
          width: 120,
          align: "center",
        },
        {
          title: "备注",
          field: "remark",
          key: "remark",
          width: 120,
          align: "center",
        },
        {
          title: "采购业务员",
          field: "purchaser",
          key: "purchaser",
          width: 140,
        },
        {
          title: "材质",
          field: "goodsMaterial",
          key: "goodsMaterial",
          width: 120,
          align: "center",
        },
        {
          title: "参考归类税号",
          field: "goodsReferInfo",
          key: "goodsReferInfo",
          width: 120,
          align: "center",
        },
        {
          title: "成分",
          field: "goodsComponent",
          key: "goodsComponent",
          width: 120,
          align: "center",
        },
        {
          title: "工作原理",
          field: "goodsWorkingPrinciple",
          key: "goodsWorkingPrinciple",
          width: 120,
          align: "center",
        },
        {
          title: "功能",
          field: "goodsFunction",
          key: "goodsFunction",
          width: 120,
          align: "center",
        },
        {
          title: "系统组成",
          field: "goodsSystemComposition",
          key: "goodsSystemComposition",
          width: 120,
          align: "center",
        },
        {
          title: "性能参数",
          field: "goodsPerformanceParameter",
          key: "goodsPerformanceParameter",
          width: 120,
          align: "center",
        },
        {
          title: "供应商名称",
          align: "center",
          field: "supplier",
          key: "supplier",
          width: 100,
        },
        {
          title: "供应商联系人",
          field: "supplierContactName",
          key: "supplierContactName",
          width: 120,
          align: "center",
        },
        {
          title: "供应商联系电话",
          field: "supplierContactMobile",
          key: "supplierContactMobile",
          width: 120,
          align: "center",
        },
      ],
      tableData:[]
    };
  },
  methods:{
    getData(data){
           if (this.tableData.length == 0) {
            this.tableData = data;
           } else {
            this.tableData = [...this.tableData, ...data];
          }
    }
  }
};
</script>

<style>
</style>
